package com.yunsc.store.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yunsc.store.dto.CouponReceiveDTO;
import com.yunsc.store.entity.YunscUserCouponEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 用户优惠券记录表
 * 
 * @author adan
 * @email 2028038953@qq.com
 * @date 2024-04-22 11:35:51
 */
@Mapper
public interface YunscUserCouponDao extends BaseMapper<YunscUserCouponEntity> {
    /**
     * 根据用户id查询优惠券id
     * @param userId 用户id
     * @return 优惠券id列表
     */
    @Select("select coupon_id from yunsc_user_coupon where user_id = #{userId}")
    List<Integer> selectUserCouponId(Integer userId);

    /**
     * 分页查询用户优惠券列表
     * @param objectPage
     * @param param
     * @param storeId
     * @return
     */
    Page<YunscUserCouponEntity> selectUserCouponPage(Page<Object> objectPage,
                                                     @Param("param") CouponReceiveDTO param,
                                                     @Param("storeId") Integer storeId,
                                                     @Param("startTime") Integer startTime,
                                                     @Param("endTime") Integer endTime
    );
}
